//
//  E7AnimationArrow.cpp
//  EndlessBattle
//
//  Created by cc on 12-4-28.
//  Copyright (c) 2012年 PalmGame. All rights reserved.
//

#include "E7AnimationArrow.h"

CE7AnimationArrow::CE7AnimationArrow()
{
}

CE7AnimationArrow::~CE7AnimationArrow()
{
}

void CE7AnimationArrow::Init(CCPoint start_pos, CCPoint end_pos, float interval)
{
    m_eID = ANI_ARROW ;
    m_bIsLoop = true ;
    m_nFrameMax = 3 ;
    m_fInterval = interval ;

    if (IsPad())
    {
        m_pSheet = CCSpriteBatchNode::batchNodeWithFile("arrow.png") ;
        
        m_pFrames = new CE7FrameInfo[m_nFrameMax] ;
        m_pFrames[0].SetInfo(m_pSheet,
                             CCRectMake(0, 0, 46, 59),
                             start_pos,
                             0.0f,
                             0.5f) ;
        m_pFrames[1].SetInfo(m_pSheet,
                             CCRectMake(0, 0, 46, 59),
                             CCPointMake((end_pos.x+start_pos.x)/2, (end_pos.y+start_pos.y)/2),
                             0.0f,
                             0.5f) ;
        m_pFrames[2].SetInfo(m_pSheet,
                             CCRectMake(0, 0, 46, 59),
                             end_pos,
                             0.0f,
                             0.5f) ;
    }
    else
    {
        m_pSheet = CCSpriteBatchNode::batchNodeWithFile("arrow_iphone.png") ;
        
        m_pFrames = new CE7FrameInfo[m_nFrameMax] ;
        m_pFrames[0].SetInfo(m_pSheet,
                             CCRectMake(0, 0, 23, 30),
                             start_pos,
                             0.0f,
                             0.5f) ;
        m_pFrames[1].SetInfo(m_pSheet,
                             CCRectMake(0, 0, 23, 30),
                             CCPointMake((end_pos.x+start_pos.x)/2, (end_pos.y+start_pos.y)/2),
                             0.0f,
                             0.5f) ;
        m_pFrames[2].SetInfo(m_pSheet,
                             CCRectMake(0, 0, 23, 30),
                             end_pos,
                             0.0f,
                             0.5f) ;
    }
}























